'''
Created on 2013-7-9

@author: v_johnnyliu
'''
#!/usr/bin/python
# -*- coding: utf-8 -*-
import poplib,os,email,mailbox,base64
from email import parser

M = poplib.POP3_SSL('pop.qq.com')
M.user('27958950@qq.com')
M.pass_('scbl617f')
messages = [M.retr(i) for i in range(1, len(M.list()[1]) + 1)]
messages = ["\n".join(mssg[1]) for mssg in messages]
messages = [parser.Parser().parsestr(mssg) for mssg in messages]
for message in messages:
    subject=message['subject']
    print subject
M.quit()
